camera_mapping = {
    'b': 'Back',
    'f': 'Front', 
    'l': 'Left',
    'r': 'Right',
    'h': 'Head'
}
midXXX_camera = {}
for key, value in camera_mapping.items():
    midXXX_camera[key] = f'mid{value}_camera'
def cameraFilter(unified_data, camera_filter_param):
    """
    Filter camera data based on specified camera filter parameter.
    
    Args:
        unified_data (dict): Unified data containing camera information
        camera_filter_param (str): Camera filter parameter (1-5 chars from 'bflrh')
                                 b = midBack_camera
                                 f = midFront_camera  
                                 l = midLeft_camera
                                 r = midRight_camera
                                 h = midHead_camera
    
    Returns:
        dict: Modified unified_data with filtered camera data
    """
    # Camera mapping

    # Parse the camera filter parameter
    if not camera_filter_param or len(camera_filter_param) == 0:
        return unified_data
    
    # Validate the parameter (should be 1-5 chars from 'bflrh')
    valid_chars = set('bflrh')
    if not all(c in valid_chars for c in camera_filter_param):
        print(f"Warning: Invalid camera filter parameter '{camera_filter_param}'. Valid chars are: bflrh")
        return unified_data
    
    # Get the cameras to keep
    cameras_to_keep = set()
    for char in camera_filter_param:
        cameras_to_keep.add(midXXX_camera[char])
    
    # Filter the camera data
    if 'cameras' in unified_data and unified_data['cameras']:
        filtered_cameras = {}
        
        for camera_name, camera_data in unified_data['cameras'].items():
            if camera_name in cameras_to_keep:
                # Keep this camera
                filtered_cameras[camera_name] = camera_data
            else:
                # Set this camera's data to empty/None
                filtered_cameras[camera_name] = {}
                for data_type in ['rgb', 'depth', 'segmentation', 'intrinsic_cv', 'extrinsic_cv', 'cam2world_gl']:
                    filtered_cameras[camera_name][data_type] = None
        
        unified_data['cameras'] = filtered_cameras
    
    return unified_data 